package view.dialogs;

import javax.swing.JPanel;

import view.components.SubnetComboBox;
import view.listeners.AddIpbyListListener;
import view.listeners.CancelListener;
import view.listeners.SubnetBoxListener;
import view.views.dialogButtonViews.AddIpButtonPanel;
import view.views.dialogContentViews.AddIpByListPanel;
import view.views.dialogContentViews.IpListPanel;

/**
 * @author Alexander Müller
 * 
 */
public class AddIpByListDialog extends Dialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private SubnetComboBox subnetCombo;
	private JPanel ipListPanel;
	private IpListPanel ipList;

	public AddIpByListDialog(String title) {
		super(title);


	}

	@Override
	protected JPanel addContent() {
		final AddIpByListPanel content = new AddIpByListPanel();
		subnetCombo = content.getSubnetComboBox();
		ipListPanel = content.getIpListPanel();
		subnetCombo.getBox().addItemListener(
				new SubnetBoxListener(this, subnetCombo, ipListPanel, ipList,
						content));
		return content;
	}

	@Override
	protected JPanel addButtons() {

		AddIpButtonPanel buttons = new AddIpButtonPanel();

		buttons.getCancelButton().addActionListener(new CancelListener(this));

		buttons.getAddButton().addActionListener(
				new AddIpbyListListener(this, subnetCombo));

		return buttons;
	}

}
